﻿@using OpenIdProvider

@{
    ViewData["Title"] = "";
}

<div class="affiliate-form-header">
    Sign in with your <span class="logo-small"></span> account
</div>

@ViewData.HandleErrorMessage()

<div class="login-form">
    <form method="post" action="/affiliate/form/login/submit">
        <table class="position-table">
            <tr>
                <td class="input-td">
                    <label for="email" class="accessibility-hidden">Email</label>
                    <input class="framed-text-field" type="text" name="email" id="email" value="@ViewData["email"]" maxlength="100" />
                    <span class="form-help">@("name@example.com")</span>
                </td>
                <td class="input-td">
                    <label for="password" class="accessibility-hidden">Password</label>
                    <input class="framed-text-field" type="password" name="password" id="password" />
                    <span class="form-help">Password</span>
                </td>
                <td></td>
                <td class="input-td">
                    <input type="submit" class="affiliate-button" value="Sign In" />
                </td>
            </tr>
        </table>

        <input type="hidden" name="affId" value="@ViewData["affId"]" />
        <input type="hidden" id="fkey" name="fkey" value="@Current.XSRFToken.Value" />
    </form>
</div>

<div style="visibility:hidden">
    <form id="xsrf-recovery" method="post" action="@ViewData["RefreshUrl"]"></form>
</div>

@*
<div class="switch">
    <a href="@(ViewData["SwitchUrl"])">Don't have an account?</a>
</div>
*@

@{
    // If the affiliate has provided a callback, call out to the parent IFrame to let it know we've loaded
    var onLoad = ViewData["OnLoad"];
    
    if(onLoad != null)
    {
        <script type="text/javascript">
            if (parent.postMessage) {
                parent.postMessage('@onLoad', '*');
            }
        </script>
    }
}